<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script>
    var json = {
	cells: {
			a: {
				attachId: 'grid',
				attachType: 'grid',
				toolbarParam: {
					"buttons": {
                        "add": false,
                            "edit": false,
                            "del": false,
                            "excelExport": {
                            "id": "excelExport",
                                "type": "button",
                                "text": "EXCEL导出",
                                "img": "btn-add-brother-group-condition.png",
                                onClick: function () {
                                common.confirm({
                                    text: "EXCEL导出",
                                    callback: function (flag) {
										debugger
										var date = $("#date").val() ? $("#date").val() : "";
                                        var paramJson = "{date:\""+date+"\"}";
										var access_token = $.cookie("access_token");
										console.log(access_token);
										console.log(GLOBAL_API_PATH);
										var url = encodeURI(GLOBAL_API_PATH+"/api/dev/excel/output/exceldownload?access_token="+access_token+"&code=att_excel&paramJson="+paramJson+"&sheetName=考勤查询&titleName=考勤查询&ExcelName=考勤查询");
										console.log(url);
										common.makeDownload(url);
                                    }
                                })
                            }
                        }
                    },
					searchers: {
						date: {
							label: "日期：",
							name: 'date',
							type: "date",
							width: 100,
							attr: {
								"id": "date",
								"data-default-value-type": "d",
								"data-default-value": 0
							}
						},
						keyword: {
							label: "关键字：",
							name: 'keyword',
							type: "text",
							width: 150
						},
						btnSearch: true
					}
				},
				gridParam: {
					isInitLoadData: false,
					target: 'grid',
					ajax: {
						url: "api/att/manage/page/list"
					},
					columns: [
						{display: '考勤号码', name: 'attendanceNum', width: 90, align: 'center'},
						{display: '姓名', name: 'name', width: 100, align: 'center'},
						{display: '日期', name: 'date', width: 100, align: 'center'},
						{display: '星期', name: 'week', width: 100, align: 'center'},
						{display: '部门', name: 'dept', width: 100, align: 'center'},
						{display: '签到时间', name: 'signInTime', width: 100, align: 'center'},
						{display: '签退时间', name: 'signBackTime', width: 100, align: 'center'},
						{
							display: '操作', width: 60, align: 'center', name: "operation",
							renderItems: {
								'del': {
									url: "api/att/manage/{id}"
								}
							}
						}
					],
					showType: 'list'
				}
			}
		}
	}
    function cc() {
        var s=JSON.stringify(json, function(key, val) {
            if (typeof val === 'function') {
                return val + '';
            }
            return val;
        });
        console.log(s);

        var ss = JSON.parse(s,function(k,v){

            if(v.indexOf&&v.indexOf('function')>-1){

                return eval("(function(){return "+v+" })()")

            }

            return v;

        });
        console.log(ss)
    }
</script>
<body>
<button onclick="cc()">生成json</button>
</body>
</html>